<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>经营日报-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<link rel="stylesheet" href="__PUBLIC__/mobile/css/mobiscroll.min.css">
</head>
<body>
<div class="header">
	<a class="menu_btn" href="javascript:;"><span class="sp1"></span><span class="sp2"></span><span class="sp3"></span></a>
	经营日报<if condition="((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id) or is_project($project['id'],52)) and ($project['status'] eq 1)">
	<if condition="($project_bg['project_stage'] eq '已开业')">
	<a class="add_btn" href="javascript:void(0)"></a>
	</if></if>
</div>
<include file="Include:commu_menu" />
<div class="content">
	<div class="operat_cont">
		<div class="tit"><span>{$year_month}</span><div id="day_btn"></div></div>
		<div class="operat_list">
		<if condition="$result eq NULL">
            <div class="no_data"></div>
        </if>
			<ul>
				<foreach name="result" item="vo">
				<li class="day{$vo['number_wk']}">
					<a href="__APP__/Mobile/Project/project_data_detail/id/{$pid}/date/{$vo['date']}/year_month/{$year_month}">
						<h3>{$vo['date']}</h3>
						<p><span class="mr10">门票：￥{$vo['m_money']}</span><span>二次消费：￥{$vo['e_money']}</span></p>
						<p><span>成本：￥{$vo['c_money']}</span></p>
					</a>
					<if condition="$vo['update'] eq 1">
						<div class="btn_box"><a href="__APP__/Mobile/Project/project_data_edit/id/{$pid}/date/{$vo['date']}/year_month/{$year_month}" class="btn icon_edit_btn mr5"></a><a href="javascript:;" pid="{$pid}" date="{$vo['date']}" class="btn icon_delete_btn" action="delete"></a></div>
					</if>
				</li>
				</foreach>
			</ul>
		</div>
	</div>
</div>
<!-- 弹出框 -->
<div class="Alert operat_fix">
	<input type="hidden" id="fix_date">
	<p class="text_c red" style="display:none">当天已填报经营数据</p>
	<div class="btn_box clearboth">
		<a class="btn_close float_l" href="javascript:;">取消</a><button class="btn_alert float_r" date="{$today}">确定</button>
	</div>
</div>
<include file="Include:javascript" />
<script src="__PUBLIC__/mobile/js/mobiscroll.min.js"></script>
<script>
	$(function(){
        menu();
    })
    $(function(){
		
		$(".icon_delete_btn").ajaxModal({"body_text":"您确定要删除吗？","url":"__APP__/Mobile/Project/project_data_list_ajax","data":{"pid":"pid","date":"date","action":"action"}});
		//添加提交
		$('.btn_alert').click(function(){
			var date = $(this).attr('date'),
				pid="{$pid}";
			$.ajax({
				type: 'POST',
				async:false,
				dataType:"json",
				data:{"date":date,"pid":pid,"action":"dates"},
				url:"__APP__/Mobile/Project/project_data_list_ajax",
				dataType: 'json',
				success: function(data){
					if(data.status){
						location.href="__APP__/Mobile/Project/project_data_add/id/{$pid}/date/"+date;
					}
					else{
						$('.operat_fix .red').html(data.msg).show();
					}
				}
			})
		})
		//添加
		$(".add_btn").click(function(){
			var now = new Date(),
				min = new Date(now.getFullYear(), now.getMonth()-1, now.getDate());
				max = new Date(now.getFullYear(), now.getMonth(), now.getDate());
			$(".operat_fix").fadeIn();
			Mask();
			$('#fix_date').mobiscroll().calendar({
				theme: 'ios',
				lang: 'zh',
				display: 'inline',
				min: min,
				max: max,
				defaultValue: now,
				dateFormat: 'yy/mm/dd',
				onDayChange: function (event, inst) {
					var date = formatDate(event.date);
					$('.btn_alert').attr('date',date);
					$('.operat_fix .red').hide();
    			}
			});
		})

		var now = new Date(),
			min = new Date(now.getFullYear()-2, now.getMonth());
        	max = new Date(now.getFullYear(), now.getMonth());
		$('#day_btn').mobiscroll().date({
			lang: 'zh',
			theme: 'ios',
			display: 'bottom',
			dateWheels: 'yy MM',
			max: max,
			min: min,
			onSet: function (event, inst) {
				var date = inst._tempValue;
					date = date .replace("\/", "-");
					date = date .replace("\/", "-");
				location.href="__APP__/Mobile/Project/project_data_list/id/{$pid}/year_month/"+date;
			},
		});
		$('.btn_close').click(function(){
			$('.red').hide();
		})
    })
</script>
</body>
</html>